package com.dfrz.stockMarket.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dfrz.stockMarket.bean.KlineDataBean;
import com.dfrz.stockMarket.dao.StockDao;
import com.dfrz.stockMarket.service.StockService;

@WebServlet("/stockpage")
public class StockControll extends BaseController {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		int stockCode = Integer.valueOf(req.getParameter("stockCode"));
		StockService service = new StockService();
		List<KlineDataBean> klineData = null;
		try {
			klineData = service.getKlineData(stockCode);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setSession(req, "kLineData", klineData);
		req.getRequestDispatcher("WEB-INF/jsp/stock.jsp").forward(req, resp);
	}
}
